import * as userType from './action-type';
import API from "src/config/api";
export const getUserInfo =  ()=>{
    return async (dispatch:any)=>{
        try{
            const res = await API.getUserInfo();
            dispatch({
                type: userType.SETUSERINFO,
                value: res
            })
        }catch(e){
            console.error(e);
        }
    }
}

export const loginOut = ()=>{
    return async (dispatch:any)=>{
        try{
            await API.loginOut();
            dispatch({
                type: userType.SETUSERINFO,
                value: null
            })
        }catch(e){
            console.error(e);
        }
    }
}